package com.meessiom.train.crm.role.repository;
import com.meessiom.train.crm.role.model.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface RoleRepository extends JpaRepository<Role,Long>,JpaSpecificationExecutor {

    @Query(value = "select role_name from roles where id = ?",nativeQuery = true)
    public String getRoleNameById(long id);

    public List<Role> findRoleByRoleNameLikeAndRoleAddressLikeAndRoleGenderLikeAndRoleAgeLikeAndRoleJobLike
            (@Param("name") String name ,  @Param("address") String address,
             @Param("age") String age, @Param("gender") String sex,@Param("job") String job);
}



